package net.dntuan.training.mvc.controller;

import java.util.Calendar;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * The simplest controller for testing Spring MVC, Freemarker configurations
 * 
 * @author tuan.dang
 */
@Controller
public class HelloController {

    /**
     * return jsp view name rather than freemarker template name
     */
    @RequestMapping("/hello")
    public String sayHello(Model model) {
        model.addAttribute("message", "konichiha");
        return "hello";
    }

    @RequestMapping("/time")
    public String getTime(Model model) {
        model.addAttribute("now", Calendar.getInstance().getTime().toString());
        return "now";
    }
}
